var e = getApp();

Page({
    data: {
        language: "",
        usable: 0,
        sure_usable: ""
    },
    onLoad: function(e) {
        this.usable = 0, this.sure_usable = "", this.getStoreInfo();
    },
    onReady: function() {
        var e = wx.getStorageSync("langIndex");
        this.setData({
            language: e.en
        });
    },
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {},
    getStoreInfo: function() {
        var t = this, n = e.getNetAddresss("plugin.froze.Frontend.Controllers.page.index");
        e._getNetWork({
            url: n,
            success: function(e) {
                var n = e.data;
                1 === n.result ? t.setData({
                    usable: n.data.thaw
                }) : wx.showToast({
                    title: n.msg,
                    icon: "none"
                });
            },
            fail: function(e) {
                console.log(e);
            }
        });
    },
    confirm: function() {
        if (null == this.data.sure_usable || this.data.sure_usable <= 0) wx.showToast({
            title: "提现数值不可低于0",
            icon: "none"
        }); else {
            var t = e.getNetAddresss("plugin.froze.Frontend.Modules.Froze.Controllers.withdraw.index");
            t += "&change_value=" + this.data.sure_usable, e._getNetWork({
                url: t,
                success: function(e) {
                    console.log(e, "数据"), 1 === e.data.result ? wx.navigateTo({
                        url: "/packageA/member/withdrawal/withdrawal"
                    }) : wx.showToast({
                        title: e.data.msg,
                        icon: "none"
                    });
                },
                fail: function(e) {
                    console.log(e);
                }
            });
        }
    },
    onChange: function(e) {
        this.setData({
            sure_usable: e.detail
        });
    }
});